/*
package com.bysc.userservice.controller;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bysc.commonutils.Results;
import com.bysc.commonutils.vo.JoinForm;
import com.bysc.userservice.client.JoinClient;
import com.bysc.userservice.entity.UserInfo;
import com.bysc.userservice.service.MailService;
import com.bysc.userservice.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;



该控制器是为了发送一面通知用的
@RestController
@RequestMapping("/test")
public class EmailTest {
    @Autowired
    private JoinClient joinClient;
    @Autowired
    private UserInfoService userInfoService;
    @Autowired
    private MailService mailService;

    @GetMapping("SendToJoin")
    public void SendToJoin() {
        int i =0;
        Results results = joinClient.getAllJoinForm();
        if (results.getSuccess()) {
            List list = (List) results.getData().get("list");
            for (Object jsonObject : list) {
                JoinForm joinForm = JSON.parseObject(JSON.toJSONString(jsonObject), JoinForm.class);
                String userId = joinForm.getUserId();
                UserInfo userInfo = userInfoService.getOne(new QueryWrapper<UserInfo>().eq("id", userId));
                if (userInfo != null) {
                    // 因为email会走熔断10分钟，分批次发邮件，以前发过了就跳过，直到发下一个
                    if (joinForm.getName().equals("岑科燊")) {
                        i++;
                    }else if (i==0) {
                        continue;
                    }
                    String email = userInfo.getEmail();
                    String massage = joinForm.getName()+"同学你好,软件协会一轮面试结果将在10月1日12点整准时公布，请大家前往官网 http://baiyunsc.cn 查询录取结果，祝生活愉快！";
                    mailService.sendAttachmentsMail(email, "广东白云学院软件协会", massage, "C:\\Users\\17211\\OneDrive\\桌面\\查询录取结果示意图.png");
                    try {
                        Thread.sleep(5000);//邮箱接口可能计算了接口调用速率，所以慢慢调用吧
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                    //mailService.sendAttachmentsMail("172110159@qq.com", "广东白云学院软件协会", massage, "C:\\Users\\17211\\OneDrive\\桌面\\查询录取结果示意图.png");
                    System.out.println("已经发送："+joinForm.getName());
                }
            }

        }

    }
}
*/
